package com.zlsy.learning.leetcode.arraycorrelation.array1480;

/**
 * @author zhouliang
 * @date 2020/06/22
 **/
public class RunningSum {
    public static int[] runningSum(int[] nums) {

        int[] newnums = new int[nums.length];

        int count = 0;
        for (int i = 0; i < nums.length; i++) {
            count += nums[i];
            newnums[i] = count;
        }
        return newnums;
    }

    public static void main(String[] args) {
        int[] nums = new int[]{1, 2, 3, 4};
        int[] ints = runningSum(nums);
        System.out.println(ints);
    }
}
